// @是src目录
import axios from '@/utils/request.js'
// 资讯分类
export default {
  namespaced: true,
  state: {
    categoryData: []
  },
  getters: {},
  mutations: {
    changeCategoryData (state, payload) {
      state.categoryData = payload;
    }
  },
  actions: {
    //查询所有资源分类
    async findAllCategory ({ commit }) {
      let res = await axios.get('/category/findAll');
      commit('changeCategoryData', res.data);
    },
    //新增或者更新
    async upadteOrSave ({ }, params) {
      let res = await axios({
        method: 'post',
        url: '/category/saveOrUpdate',
        params: params
      })
    },
    // 根据id删除
    async deleteById ({ }, params) {
      let res = await axios({
        method: 'get',
        url: '/category/deleteById',
        params: params
      });

      // let res = await axios.get({
      //   method:'get',
      //   url:''
      // })


    }
  }
}

